home *** CD-ROM | disk | FTP | other *** search
/ Info-Mac 3 / Info_Mac_1994-01.iso / Development / Source / Little C Source / Ex4.c < prev    next >
C/C++ Source or Header  |  1993-10-04  |  206b  |  17 lines

  1. /* This program demonstrates recursive functions. */
  2. main()
  3. {
  4.  print(factr(7) * 2);
  5. }
  6.  
  7. /* return the factorial of i */
  8. factr(int i)
  9. {
  10.   if(i<2) {
  11.     return 1;
  12.   }
  13.   else {
  14.     return i * factr(i-1);
  15.   }
  16. }
  17.